package com.daoeping.action;

import java.util.ArrayList;
import java.util.List;
import com.daoeping.data.Bsc_workyear;
import com.daoeping.domain.JsonData;
import com.daoeping.service.Bsc_workyearService;
import com.daoeping.util.ConverntJsonData;
import com.opensymphony.xwork2.ActionSupport;

public class Bsc_workyearAction extends ActionSupport{
	
	private static final long serialVersionUID = 1884739319244961000L;
	
	private Bsc_workyearService bsc_workyearService;
	private JsonData jsonData;
	private List<Bsc_workyear> bsc_workyearList;
	
	public Bsc_workyearService getBsc_workyearService() {
		return bsc_workyearService;
	}

	public void setBsc_workyearService(Bsc_workyearService bsc_workyearService) {
		this.bsc_workyearService = bsc_workyearService;
	}

	public List<Bsc_workyear> getBsc_workyearList() {
		return bsc_workyearList;
	}

	public void setBsc_workyearList(List<Bsc_workyear> bsc_workyearList) {
		this.bsc_workyearList = bsc_workyearList;
	}

	public JsonData getJsonData() {
		return jsonData;
	}

	public void setJsonData(JsonData jsonData) {
		this.jsonData = jsonData;
	}

	public String findAllWorkYear(){
		jsonData = new JsonData();
		bsc_workyearList = bsc_workyearService.findBsc_workyearList();
		List <String[]> strList = new ArrayList<String[]>();
		for (Bsc_workyear bsc_workyear : bsc_workyearList) {
			String [] strarr = new String[2];
			strarr[1] = bsc_workyear.getId()+"";
			strarr[0] = bsc_workyear.getWorkyear()+"";
			strList.add(strarr);
		}
		jsonData.setJsonData( new ConverntJsonData().getJsonData(strList)+"");
		return "allworkyear";
		
	}
	
}
